//Microsoft .NET Namespaces
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
//Aspose Namespaces
using Aspose.Pdf.Generator;
using Aspose.Words;
using Aspose.Cells;
using Aspose.Tasks;
using Aspose.Slides;
using Aspose.BarCode;
using Aspose.BarCodeRecognition;


namespace AsposeQuickStart
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Program started...\n");

            //initialize log file every time program executes 
            Settings.InitializeLog();
            
            //set license of Aspose components
            //if you do not have license then either comment this or get a temporary license
            //if (AsposeLicense.SetLicense() == false)
            //{
            //    Console.WriteLine("Sorry, license was not set correctly.");
            //    Settings.ExitProgram();
            //}


            //create a temporary memory stream
            MemoryStream tempDocument = new MemoryStream();
            string DocumentName = "MyDocument"; //or any other name of your choice
            bool isSaved = false;
            bool isRetrieved = false;

            //process PDF document
            tempDocument = AsposeFileExpert.CreateNewDocument(DocumentType.PDF);
            isSaved = DatabaseManager.SaveDocumentToDatabase(tempDocument, DocumentType.PDF, DocumentName);
            isRetrieved = DatabaseManager.LoadDocumentFromDataBase(DocumentType.PDF);

            //process Word document
            tempDocument = AsposeFileExpert.CreateNewDocument(DocumentType.DOC);
            isSaved = DatabaseManager.SaveDocumentToDatabase(tempDocument, DocumentType.DOC, DocumentName);
            isRetrieved = DatabaseManager.LoadDocumentFromDataBase(DocumentType.DOC);
            
            //process Excel document
            tempDocument = AsposeFileExpert.CreateNewDocument(DocumentType.XLS);
            isSaved = DatabaseManager.SaveDocumentToDatabase(tempDocument, DocumentType.XLS, DocumentName);
            isRetrieved = DatabaseManager.LoadDocumentFromDataBase(DocumentType.XLS);

            //process Powerpoint presentation
            tempDocument = AsposeFileExpert.CreateNewDocument(DocumentType.PPT);
            isSaved = DatabaseManager.SaveDocumentToDatabase(tempDocument, DocumentType.PPT, DocumentName);
            isRetrieved = DatabaseManager.LoadDocumentFromDataBase(DocumentType.PPT);

            //process Barcode image
            tempDocument = AsposeFileExpert.CreateNewDocument(DocumentType.BARCODE);
            isSaved = DatabaseManager.SaveDocumentToDatabase(tempDocument, DocumentType.BARCODE, DocumentName);
            isRetrieved = DatabaseManager.LoadDocumentFromDataBase(DocumentType.BARCODE);

            //process Project file
            tempDocument = AsposeFileExpert.CreateNewDocument(DocumentType.PROJECT);
            isSaved = DatabaseManager.SaveDocumentToDatabase(tempDocument, DocumentType.PROJECT, DocumentName);
            isRetrieved = DatabaseManager.LoadDocumentFromDataBase(DocumentType.PROJECT);
            

            Settings.ExitProgram();
         
        }
    }
}
